package com.gitee.wsl.flow.api

import kotlinx.coroutines.flow.StateFlow

interface StateFlowAble<STATE> {
    fun asStateFlow(): StateFlow<STATE>
}

/**
 * Represents mutable state.
 *
 * @property STATE Immutable State model type
 * @property MUTABLE_STATE Mutable State model type
 */
interface MutableStateFlowAble<STATE, MUTABLE_STATE : STATE> : StateFlowAble<STATE> {
    /**
     * Updates the [MUTABLE_STATE].
     *
     * @param mutate A lambda block which allows to perform mutation on [MUTABLE_STATE].
     */
    fun update(mutate: MUTABLE_STATE.() -> Unit)
}
